#结构模式匹配
data = {'name': 'ldd', 'age': 18}
match data:
    case {'name': 'ldd', 'age': 18}:
        print('字典')
    case [10, 20, 30]:
        print('列表')
    case (10, 20, 30):
        print('元组')
    case _:
        print('相当于多重if中的else')  # 所有的都不匹配，才会执行这个


#字典合并运算符
d1={'a':10,'b':20}
d2={'c':30,'d':40,'e':50}
print(d1|d2)

#同步迭代
#fruits={'apple','orange','pear','grape'}#集合是无序的
fruits=['apple','orange','pear','grape']
counts=[11,12,34,33]
for f,c in zip(fruits,counts):
    match f,c:
        case 'apple',11:
            print('11个苹果')
        case 'orange', 12:
            print('12个橘子')
        case 'pear', 34:
            print('34个梨子')
        case 'grape', 33:
            print('33个葡萄')